//
//	UserInfoModel.m
//
//	Create by 畅 宋 on 17/12/2016
//	Copyright © 2016. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "UserInfoModel.h"

NSString *const kUserInfoModelAccountsName = @"accountsName";
NSString *const kUserInfoModelAccountsPassword = @"accountsPassword";
NSString *const kUserInfoModelBirthday = @"birthday";
NSString *const kUserInfoModelBusinessCode = @"businessCode";
NSString *const kUserInfoModelCode = @"code";
NSString *const kUserInfoModelCreateTime = @"createTime";
NSString *const kUserInfoModelHandleMessageCount = @"handleMessageCount";
NSString *const kUserInfoModelIdField = @"id";
NSString *const kUserInfoModelInductionDate = @"inductionDate";
NSString *const kUserInfoModelIsAdmin = @"isAdmin";
NSString *const kUserInfoModelIsDel = @"isDel";
NSString *const kUserInfoModelIsRole = @"isRole";
NSString *const kUserInfoModelLastUpdateTime = @"lastUpdateTime";
NSString *const kUserInfoModelPhoneNumber = @"phoneNumber";
NSString *const kUserInfoModelRealName = @"realName";
NSString *const kUserInfoModelSex = @"sex";
NSString *const kUserInfoModelStoreCode = @"storeCode";
NSString *const kUserInfoModelUserEmail = @"userEmail";
NSString *const kUserInfoModelUserLevel = @"userLevel";
NSString *const kUserInfoModelWechatNumber = @"wechatNumber";

@interface UserInfoModel ()
@end
@implementation UserInfoModel




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kUserInfoModelAccountsName] isKindOfClass:[NSNull class]]){
		self.accountsName = dictionary[kUserInfoModelAccountsName];
	}	
	if(![dictionary[kUserInfoModelAccountsPassword] isKindOfClass:[NSNull class]]){
		self.accountsPassword = dictionary[kUserInfoModelAccountsPassword];
	}	
	if(![dictionary[kUserInfoModelBirthday] isKindOfClass:[NSNull class]]){
		self.birthday = [dictionary[kUserInfoModelBirthday] integerValue];
	}

	if(![dictionary[kUserInfoModelBusinessCode] isKindOfClass:[NSNull class]]){
		self.businessCode = dictionary[kUserInfoModelBusinessCode];
	}	
	if(![dictionary[kUserInfoModelCode] isKindOfClass:[NSNull class]]){
		self.code = dictionary[kUserInfoModelCode];
	}	
	if(![dictionary[kUserInfoModelCreateTime] isKindOfClass:[NSNull class]]){
		self.createTime = [dictionary[kUserInfoModelCreateTime] integerValue];
	}

	if(![dictionary[kUserInfoModelHandleMessageCount] isKindOfClass:[NSNull class]]){
		self.handleMessageCount = [dictionary[kUserInfoModelHandleMessageCount] integerValue];
	}

	if(![dictionary[kUserInfoModelIdField] isKindOfClass:[NSNull class]]){
		self.idField = [dictionary[kUserInfoModelIdField] integerValue];
	}

	if(![dictionary[kUserInfoModelInductionDate] isKindOfClass:[NSNull class]]){
		self.inductionDate = [dictionary[kUserInfoModelInductionDate] integerValue];
	}

	if(![dictionary[kUserInfoModelIsAdmin] isKindOfClass:[NSNull class]]){
		self.isAdmin = [dictionary[kUserInfoModelIsAdmin] integerValue];
	}

	if(![dictionary[kUserInfoModelIsDel] isKindOfClass:[NSNull class]]){
		self.isDel = [dictionary[kUserInfoModelIsDel] integerValue];
	}

	if(![dictionary[kUserInfoModelIsRole] isKindOfClass:[NSNull class]]){
		self.isRole = [dictionary[kUserInfoModelIsRole] integerValue];
	}

	if(![dictionary[kUserInfoModelLastUpdateTime] isKindOfClass:[NSNull class]]){
		self.lastUpdateTime = [dictionary[kUserInfoModelLastUpdateTime] integerValue];
	}

	if(![dictionary[kUserInfoModelPhoneNumber] isKindOfClass:[NSNull class]]){
		self.phoneNumber = dictionary[kUserInfoModelPhoneNumber];
	}	
	if(![dictionary[kUserInfoModelRealName] isKindOfClass:[NSNull class]]){
		self.realName = dictionary[kUserInfoModelRealName];
	}	
	if(![dictionary[kUserInfoModelSex] isKindOfClass:[NSNull class]]){
		self.sex = [dictionary[kUserInfoModelSex] integerValue];
	}

	if(![dictionary[kUserInfoModelStoreCode] isKindOfClass:[NSNull class]]){
		self.storeCode = dictionary[kUserInfoModelStoreCode];
	}	
	if(![dictionary[kUserInfoModelUserEmail] isKindOfClass:[NSNull class]]){
		self.userEmail = dictionary[kUserInfoModelUserEmail];
	}	
	if(![dictionary[kUserInfoModelUserLevel] isKindOfClass:[NSNull class]]){
		self.userLevel = [dictionary[kUserInfoModelUserLevel] integerValue];
	}

	if(![dictionary[kUserInfoModelWechatNumber] isKindOfClass:[NSNull class]]){
		self.wechatNumber = dictionary[kUserInfoModelWechatNumber];
	}	
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.accountsName != nil){
		dictionary[kUserInfoModelAccountsName] = self.accountsName;
	}
	if(self.accountsPassword != nil){
		dictionary[kUserInfoModelAccountsPassword] = self.accountsPassword;
	}
	dictionary[kUserInfoModelBirthday] = @(self.birthday);
	if(self.businessCode != nil){
		dictionary[kUserInfoModelBusinessCode] = self.businessCode;
	}
	if(self.code != nil){
		dictionary[kUserInfoModelCode] = self.code;
	}
	dictionary[kUserInfoModelCreateTime] = @(self.createTime);
	dictionary[kUserInfoModelHandleMessageCount] = @(self.handleMessageCount);
	dictionary[kUserInfoModelIdField] = @(self.idField);
	dictionary[kUserInfoModelInductionDate] = @(self.inductionDate);
	dictionary[kUserInfoModelIsAdmin] = @(self.isAdmin);
	dictionary[kUserInfoModelIsDel] = @(self.isDel);
	dictionary[kUserInfoModelIsRole] = @(self.isRole);
	dictionary[kUserInfoModelLastUpdateTime] = @(self.lastUpdateTime);
	if(self.phoneNumber != nil){
		dictionary[kUserInfoModelPhoneNumber] = self.phoneNumber;
	}
	if(self.realName != nil){
		dictionary[kUserInfoModelRealName] = self.realName;
	}
	dictionary[kUserInfoModelSex] = @(self.sex);
	if(self.storeCode != nil){
		dictionary[kUserInfoModelStoreCode] = self.storeCode;
	}
	if(self.userEmail != nil){
		dictionary[kUserInfoModelUserEmail] = self.userEmail;
	}
	dictionary[kUserInfoModelUserLevel] = @(self.userLevel);
	if(self.wechatNumber != nil){
		dictionary[kUserInfoModelWechatNumber] = self.wechatNumber;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.accountsName != nil){
		[aCoder encodeObject:self.accountsName forKey:kUserInfoModelAccountsName];
	}
	if(self.accountsPassword != nil){
		[aCoder encodeObject:self.accountsPassword forKey:kUserInfoModelAccountsPassword];
	}
	[aCoder encodeObject:@(self.birthday) forKey:kUserInfoModelBirthday];	if(self.businessCode != nil){
		[aCoder encodeObject:self.businessCode forKey:kUserInfoModelBusinessCode];
	}
	if(self.code != nil){
		[aCoder encodeObject:self.code forKey:kUserInfoModelCode];
	}
	[aCoder encodeObject:@(self.createTime) forKey:kUserInfoModelCreateTime];	[aCoder encodeObject:@(self.handleMessageCount) forKey:kUserInfoModelHandleMessageCount];	[aCoder encodeObject:@(self.idField) forKey:kUserInfoModelIdField];	[aCoder encodeObject:@(self.inductionDate) forKey:kUserInfoModelInductionDate];	[aCoder encodeObject:@(self.isAdmin) forKey:kUserInfoModelIsAdmin];	[aCoder encodeObject:@(self.isDel) forKey:kUserInfoModelIsDel];	[aCoder encodeObject:@(self.isRole) forKey:kUserInfoModelIsRole];	[aCoder encodeObject:@(self.lastUpdateTime) forKey:kUserInfoModelLastUpdateTime];	if(self.phoneNumber != nil){
		[aCoder encodeObject:self.phoneNumber forKey:kUserInfoModelPhoneNumber];
	}
	if(self.realName != nil){
		[aCoder encodeObject:self.realName forKey:kUserInfoModelRealName];
	}
	[aCoder encodeObject:@(self.sex) forKey:kUserInfoModelSex];	if(self.storeCode != nil){
		[aCoder encodeObject:self.storeCode forKey:kUserInfoModelStoreCode];
	}
	if(self.userEmail != nil){
		[aCoder encodeObject:self.userEmail forKey:kUserInfoModelUserEmail];
	}
	[aCoder encodeObject:@(self.userLevel) forKey:kUserInfoModelUserLevel];	if(self.wechatNumber != nil){
		[aCoder encodeObject:self.wechatNumber forKey:kUserInfoModelWechatNumber];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.accountsName = [aDecoder decodeObjectForKey:kUserInfoModelAccountsName];
	self.accountsPassword = [aDecoder decodeObjectForKey:kUserInfoModelAccountsPassword];
	self.birthday = [[aDecoder decodeObjectForKey:kUserInfoModelBirthday] integerValue];
	self.businessCode = [aDecoder decodeObjectForKey:kUserInfoModelBusinessCode];
	self.code = [aDecoder decodeObjectForKey:kUserInfoModelCode];
	self.createTime = [[aDecoder decodeObjectForKey:kUserInfoModelCreateTime] integerValue];
	self.handleMessageCount = [[aDecoder decodeObjectForKey:kUserInfoModelHandleMessageCount] integerValue];
	self.idField = [[aDecoder decodeObjectForKey:kUserInfoModelIdField] integerValue];
	self.inductionDate = [[aDecoder decodeObjectForKey:kUserInfoModelInductionDate] integerValue];
	self.isAdmin = [[aDecoder decodeObjectForKey:kUserInfoModelIsAdmin] integerValue];
	self.isDel = [[aDecoder decodeObjectForKey:kUserInfoModelIsDel] integerValue];
	self.isRole = [[aDecoder decodeObjectForKey:kUserInfoModelIsRole] integerValue];
	self.lastUpdateTime = [[aDecoder decodeObjectForKey:kUserInfoModelLastUpdateTime] integerValue];
	self.phoneNumber = [aDecoder decodeObjectForKey:kUserInfoModelPhoneNumber];
	self.realName = [aDecoder decodeObjectForKey:kUserInfoModelRealName];
	self.sex = [[aDecoder decodeObjectForKey:kUserInfoModelSex] integerValue];
	self.storeCode = [aDecoder decodeObjectForKey:kUserInfoModelStoreCode];
	self.userEmail = [aDecoder decodeObjectForKey:kUserInfoModelUserEmail];
	self.userLevel = [[aDecoder decodeObjectForKey:kUserInfoModelUserLevel] integerValue];
	self.wechatNumber = [aDecoder decodeObjectForKey:kUserInfoModelWechatNumber];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	UserInfoModel *copy = [UserInfoModel new];

	copy.accountsName = [self.accountsName copy];
	copy.accountsPassword = [self.accountsPassword copy];
	copy.birthday = self.birthday;
	copy.businessCode = [self.businessCode copy];
	copy.code = [self.code copy];
	copy.createTime = self.createTime;
	copy.handleMessageCount = self.handleMessageCount;
	copy.idField = self.idField;
	copy.inductionDate = self.inductionDate;
	copy.isAdmin = self.isAdmin;
	copy.isDel = self.isDel;
	copy.isRole = self.isRole;
	copy.lastUpdateTime = self.lastUpdateTime;
	copy.phoneNumber = [self.phoneNumber copy];
	copy.realName = [self.realName copy];
	copy.sex = self.sex;
	copy.storeCode = [self.storeCode copy];
	copy.userEmail = [self.userEmail copy];
	copy.userLevel = self.userLevel;
	copy.wechatNumber = [self.wechatNumber copy];

	return copy;
}
@end